﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：庄金冬 
    //
    // 文件名：IBLL_Distribution.cs
    // 文件功能描述：配送关系接口
    // 创建标识：庄金冬2009-03-06
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
    // 审核时间：
    // 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;

using System.Text;
using HZ.DrugTrade.Model;
using HZ.DrugTrade;
namespace HZ.DrugTrade.IBLL
{
    /// <summary>
    /// 配送关系接口
    /// </summary>
    public interface IBLL_Distribution
    {
        #region 配送关系操作
        /// <summary>
        /// 新增非中标产品配送关系
        /// </summary>
        /// <param name="distributionrelation"></param>
        /// <returns></returns>
        int AddDistributionUnBid(HZ.DrugTrade.Model.DistributionRelation distributionrelation);
        /// <summary>
        /// 增加配送关系
        /// </summary>
        /// <param name="distributionrelation">配送关系</param>
        int AddDistribution(HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 删除配送关系
        /// </summary>
        /// <param name="distributionrelation">配送关系【ProcureCatalogID，CompanyID_PS，HospitalID必填】</param>
        int DelDistribution(HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 批量增加配送关系
        /// </summary>
        /// <param name="distributionrelationList">配送关系集合</param>
        int AddDistribution_Batch(IList<HZ.DrugTrade.Model.DistributionRelation> distributionrelationList);

        /// <summary>
        /// 批量增加配送关系(从采购目录及企业角度增加医疗机构)
        /// </summary>
        /// <param name="distributionrelationList">配送关系集合</param>
        /// <param name="distributionrelation">配送关系:ProcureCatalogID,CompanyID_PS必填</param>
        int AddDistributionByProcureCatalogCompany_Batch(IList<HZ.DrugTrade.Model.DistributionRelation> distributionrelationList, HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 批量增加配送关系(从采购目录及医疗机构角度增加企业)
        /// </summary>
        /// <param name="distributionrelationList">配送关系集合</param>
        /// <param name="distributionrelation">配送关系:ProcureCatalogID,HospitalID必填</param>
        int AddDistributionByProcureCatalogHospital_Batch(IList<HZ.DrugTrade.Model.DistributionRelation> distributionrelationList, HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 批量增加配送关系(从企业及医疗机构角度增加采购目录)
        /// </summary>
        /// <param name="distributionrelationList">配送关系集合</param>
        /// <param name="distributionrelation">配送关系:CompanyID_PS,HospitalID必填</param>
        int AddDistributionByCompanyHospital_Batch(IList<HZ.DrugTrade.Model.DistributionRelation> distributionrelationList, HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 更新配送关系
        /// </summary>
        /// <param name="distributionrelation">配送关系</param>
        /// <returns>0.失败1.成功</returns>
        int UpdateDistribution(HZ.DrugTrade.Model.DistributionRelation distributionrelation);


        /// <summary>
        /// 更新配送企业以及交易价格
        /// </summary>
        /// <param name="distributionrelation">配送企业及价格不能空</param>
        /// <returns></returns>
        int UpdateDistribution_CompanyPrice(HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        /// <summary>
        /// 撤废/取消撤废配送关系
        /// </summary>
        /// <param name="distributionrelation">IsUsing不能空</param>
        /// <returns></returns>
        int UpdateDistribution_IsUsing(HZ.DrugTrade.Model.DistributionRelation distributionrelation);

        #endregion

        #region 配送关系查询
        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="distribution">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.DistributionRelation> GetDistributionByWhere(HZ.DrugTrade.Model.Query.DistributionRelation distribution, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 获取未在采购单明细的配送关系
        /// </summary>
        /// <param name="distribution">配送关系查询</param>
        /// <param name="orderdetail">采购单明细</param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.DistributionRelation> GetDistributionByWhereNotInCurrentPurchaseOrder(HZ.DrugTrade.Model.Query.DistributionRelation distribution, IList<HZ.DrugTrade.Model.View.PurchaseOrderDetail> orderdetail, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 条件查询【地区医疗机构采购目录】
        /// </summary>
        /// <param name="where">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.AreaHospitalProcureCatalo> GetAreaHospitalProcureCatalogByWhere(HZ.DrugTrade.Model.Query.AreaHospitalProcureCatalo where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件查询【地区医疗机构】[可根据HospitalName，AreaID(省级-省级编号,市级-市级编号)查询]
        /// </summary>
        /// <param name="where">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.AreaHospitalProcureCatalo> GetAreaHospitalByWhere(HZ.DrugTrade.Model.Query.AreaHospitalProcureCatalo where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 获取ProcureCatalogID的所有配送关系
        /// </summary>
        /// <param name="ProcureCatalogID">采购目录编号</param>
        /// <param name="Hospital">医疗机构实体</param>
        /// <returns>可配送企业列表</returns>
        IList<Company> GetDistributionRelationByHospital(string ProcureCatalogID, User Hospital);

        /// <summary>
        /// 获取医疗机构默认
        /// </summary>
        /// <param name="distribution"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.DistributionRelation> GetHospitalProcureCatalog_With_DefaultDistribution_Company(HZ.DrugTrade.Model.Query.DistributionRelation distribution, int currentpage, int pagesize, out int totalrecord);


        #endregion

        #region 配送情况查询
        /// <summary>
        /// 条件查询【配送情况】
        /// </summary>
        /// <param name="distribution">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.Distribution> GetDistributionByWhere(HZ.DrugTrade.Model.Query.Distribution distribution, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件获取未配送信息
        /// </summary>
        /// <param name="distribution">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.Distribution> GetNoDistributionByWhere(HZ.DrugTrade.Model.Query.Distribution distribution, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件获取采购单明细配送单情况信息（DistributeState：0.待验收；1.已验收）
        /// </summary>
        /// <param name="distribution">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.Distribution> GetNoWarehouseByWhere(HZ.DrugTrade.Model.Query.Distribution distribution, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件获取已入库（验收）信息
        /// </summary>
        /// <param name="distribution">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.Distribution> GetWarehouseByWhere(HZ.DrugTrade.Model.Query.Distribution distribution, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 获取地区分配送信息
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.AreaDistribution> GetAreaDistribution(HZ.DrugTrade.Model.Query.AreaDistribution where, int currentpage, int pagesize, out int totalrecord);




        #endregion

        #region 转配送部分
        /// <summary>
        /// 批量增加转配送日志
        /// </summary>
        /// <param name="loglist">转配送记录</param>
        /// <returns>(1成功0失败)</returns>
        int AddTransformDistributionLog(IList<TransformDistributionLog> loglist);

        /// <summary>
        /// 查询转配送记录
        /// </summary>
        /// <param name="where">查询条件</param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.TransformDistributionLog> GetDistributionLog(Model.Query.TransformDistributionLog where, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 往下追溯转配送记录
        /// (追溯转配送给谁了)
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="areaID"></param>
        /// <param name="ProcureCatalogID"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.TransformDistributionLog> GetDistributionLogDown(string companyID, string areaID, string ProcureCatalogID);
        /// <summary>
        /// 往上追溯转配送记录
        /// (追溯转谁转配送给我的)
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="areaID"></param>
        /// <param name="ProcureCatalogID"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.TransformDistributionLog> GetDistributionLogUp(string companyID, string areaID, string ProcureCatalogID);
        /// <summary>
        /// 获取转配送给别人的产品列表信息
        /// </summary>
        /// <param name="companyID">当前企业ID</param>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ProcureCatalog> GetTransformProcureCatalogTo(string companyID, Model.Query.ProcureCatalog where, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 获取别人转配送给我的产品列表信息
        /// </summary>
        /// <param name="companyID">>当前企业ID</param>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ProcureCatalog> GetTransformProcureCatalogFrom(string companyID, Model.Query.ProcureCatalog where, int currentpage, int pagesize, out int totalrecord);
        #endregion

        #region 分配送部分

        /// <summary>
        /// 批量增加分配送日志
        /// </summary>
        /// <param name="loglist">分配送记录</param>
        /// <returns>(1成功0失败)</returns>
        int AddPartDistributionLog(IList<PartDistributionLog> loglist);

        /// <summary>
        /// 获取医疗机构某采购目录的可用的配送企业
        /// </summary>
        /// <param name="ProcureCatalogID"></param>
        /// <param name="HospitalID"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.AreaDistribution> GetPartDistribution(string ProcureCatalogID, string HospitalID, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 获取分配送情况
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.Distribution> GetPartDistribution(HZ.DrugTrade.Model.Query.Distribution where, string fathercompanyID, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 主配送获取可管理分配送产品
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        /// 获取企业可管理产品使用 View_ProcureCatalog by lig 20091115
        //IList<HZ.DrugTrade.Model.View.DistributionManage> GetAreaDistributionManage(HZ.DrugTrade.Model.Query.DistributionManage where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 批量删除地区配送关系
        /// </summary>
        /// <param name="DeleteList"></param>
        /// <returns></returns>
        int DeleteAreaDistribution_Batch(IList<AreaDistribution> DeleteList);
        #endregion


        /// <summary>
        /// 获取企业被采购目录
        /// </summary>
        /// <param name="where"></param>
        /// <param name="CurrentPage"></param>
        /// <param name="PageSize"></param>
        /// <param name="TotalRecord"></param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.CompanyProcureCatalog> GetCompanyProcureCatalog(HZ.DrugTrade.Model.Query.CompanyProcureCatalog where, int CurrentPage, int PageSize, out int TotalRecord);
    }
}
